<?php
	
	class GP_page_store_locator extends GP_controleur
	{
		var $controleur;
		var $db;
		
		function __construct()
		{
			global $page;
			$this -> controleur = parent::getInstance($page);
		}
		
		function get_countries()
		{
			$requete = "SELECT country FROM _fo_stores GROUP BY country";
			return $this -> db -> fetchArray($requete);
		}
		
		function afficher()
		{			
			global $page, $urirw;
			
			// si url rewrite
			if (strlen($urirw))
			{
				$pagerw = fakeurl($urirw);
				$htmltmp = $this -> controleur -> htmlrw('header');
				$htmltmp .= $this -> controleur -> htmlrw($page);
				$htmltmp .= $this -> controleur -> htmlrw('footer');
				savefile($pagerw, $htmltmp);
				if (!IS_IE)
					header("HTTP/1.1 301 Moved Permanently");
				include($urirw);
			}
			else
			{
				$this -> controleur -> add_html('header');
				$this -> controleur -> add_html($page);
				$this -> controleur -> add_html('footer');
			}
		}
		
		function setvar($var, $val)
		{
			global $urirw;
			if (strlen($urirw))
				$this -> $var = $val;
			else
				$this -> controleur -> $var = $val;
		}
	}
	
	$page_store_locator = new GP_page_store_locator;
	$page_store_locator -> db = GP_db::getInstance(BDD_DSN, BDD_UTILISATEUR, BDD_MOT_DE_PASSE);
	$page_store_locator -> setvar('titre', 'Find perfume stores where you can buy fragrances and candles by Comme des Garcons');
	$page_store_locator -> setvar('liste_pays', $page_store_locator -> get_countries());
	$page_store_locator -> setvar('meta_description', 'The Store Locator will help you find the closest Comme des Garcons store to buy perfume or fragrance which will match your tastes');
	$page_store_locator -> setvar('meta_keywords', 'Perfume shop, perfume store, fragrance shop, buy perfume, buy perfumes online, perfume offers, dover street market, comme des garcons online shop');
	$page_store_locator -> afficher();
?>